package config

import (
	"common/helper"
	"database/sql"
)

type CfgDeposit struct {
	Deposit int
}

type CfgDepositAward struct {
	DepositMin     int
	DepositMax     int
	ReturnRate     int //千分比
	FirstReturRate int //首充返还比例(千分比)
}

type CfgDepositCfg struct {
	cfgDeposit      []CfgDeposit
	cfgDepositAward []CfgDepositAward
}

var G_cfgDepositCfg CfgDepositCfg

func DepositRemove() {
	G_cfgDepositCfg.cfgDeposit = []CfgDeposit{}
}

func DepositSetRow(rows *sql.Rows) {
	var tVal CfgDeposit
	var err error
	err = rows.Scan(&tVal.Deposit)
	if err != nil {
		helper.InfoLog("DepositSetRow scan err")
		return
	}
	G_cfgDepositCfg.cfgDeposit = append(G_cfgDepositCfg.cfgDeposit, tVal)
}

func DepositAwardRemove() {
	G_cfgDepositCfg.cfgDepositAward = []CfgDepositAward{}
}

func DepositAwardSetRow(rows *sql.Rows) {
	var tVal CfgDepositAward
	var err error
	err = rows.Scan(&tVal.DepositMin, &tVal.DepositMax, &tVal.ReturnRate, &tVal.FirstReturRate)
	if err != nil {
		helper.InfoLog("DepositAwardSetRow scan err")
		return
	}
	G_cfgDepositCfg.cfgDepositAward = append(G_cfgDepositCfg.cfgDepositAward, tVal)
}
